package com.dunqi.gpm.cangxi.home.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseViewHolder;
import com.dunqi.gpm.cangxi.R;
import com.dunqi.gpm.cangxi.common.base.RecyclerAdapter;
import com.dunqi.gpm.cangxi.home.activity.Management;
import com.dunqi.gpm.cangxi.mine.util.UserUtil;

import java.util.List;

/**
 * Created by 空 on 2018/2/6 0006.
 */
public class SupervisoryManagementAdapter extends RecyclerAdapter<Management> {
    public SupervisoryManagementAdapter(@Nullable List<Management> data) {
        super(R.layout.item_supervisory_management, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Management item) {
        String reportPeriod = item.getReportPeriod();
        if (!TextUtils.isEmpty(reportPeriod)) {
            reportPeriod = reportPeriod.substring(0, 10);
        }

        helper.setText(R.id.content_tv, item.getSuperviseContent())
                .setText(R.id.time_tv, "督办时间:" + item.getSuperviseTime())
                .setText(R.id.pro_name_tv, "项目名称:" + item.getProjectName())
                .setText(R.id.month_tv, "汇报月份:" + reportPeriod)
                .setText(R.id.person_tv, "督办人:" + item.getSuperviserName());

        helper.setVisible(R.id.pro_name_tv, UserUtil.userFromRespOrg())
                .setVisible(R.id.pro_name_tv, UserUtil.userFromRespOrg());
    }
}
